/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class RetrieveAndUpdateTaller1PDSData {
	public void retrieveAndUpdateTestData() throws PersistentException {
		PersistentTransaction t = com.pancho.Taller1PDSPersistentManager.instance().getSession().beginTransaction();
		try {
			com.pancho.Pacient lcompanchoPacient = com.pancho.PacientDAO.loadPacientByQuery(null, null);
			// Update the properties of the persistent object
			com.pancho.PacientDAO.save(lcompanchoPacient);
			com.pancho.User lcompanchoUser = com.pancho.UserDAO.loadUserByQuery(null, null);
			// Update the properties of the persistent object
			com.pancho.UserDAO.save(lcompanchoUser);
			com.pancho.Doctor lcompanchoDoctor = com.pancho.DoctorDAO.loadDoctorByQuery(null, null);
			// Update the properties of the persistent object
			com.pancho.DoctorDAO.save(lcompanchoDoctor);
			com.pancho.BabyMonitor lcompanchoBabyMonitor = com.pancho.BabyMonitorDAO.loadBabyMonitorByQuery(null, null);
			// Update the properties of the persistent object
			com.pancho.BabyMonitorDAO.save(lcompanchoBabyMonitor);
			com.pancho.Solution lcompanchoSolution = com.pancho.SolutionDAO.loadSolutionByQuery(null, null);
			// Update the properties of the persistent object
			com.pancho.SolutionDAO.save(lcompanchoSolution);
			com.pancho.Diagnose lcompanchoDiagnose = com.pancho.DiagnoseDAO.loadDiagnoseByQuery(null, null);
			// Update the properties of the persistent object
			com.pancho.DiagnoseDAO.save(lcompanchoDiagnose);
			com.pancho.Response lcompanchoResponse = com.pancho.ResponseDAO.loadResponseByQuery(null, null);
			// Update the properties of the persistent object
			com.pancho.ResponseDAO.save(lcompanchoResponse);
			com.pancho.Question lcompanchoQuestion = com.pancho.QuestionDAO.loadQuestionByQuery(null, null);
			// Update the properties of the persistent object
			com.pancho.QuestionDAO.save(lcompanchoQuestion);
			com.pancho.QuestForm lcompanchoQuestForm = com.pancho.QuestFormDAO.loadQuestFormByQuery(null, null);
			// Update the properties of the persistent object
			com.pancho.QuestFormDAO.save(lcompanchoQuestForm);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public void retrieveByCriteria() throws PersistentException {
		System.out.println("Retrieving Pacient by PacientCriteria");
		com.pancho.PacientCriteria pacientCriteria = new com.pancho.PacientCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//pacientCriteria.idPaciente.eq();
		System.out.println(pacientCriteria.uniquePacient());
		
		System.out.println("Retrieving User by UserCriteria");
		com.pancho.UserCriteria userCriteria = new com.pancho.UserCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//userCriteria.codUser.eq();
		System.out.println(userCriteria.uniqueUser());
		
		System.out.println("Retrieving Doctor by DoctorCriteria");
		com.pancho.DoctorCriteria doctorCriteria = new com.pancho.DoctorCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//doctorCriteria.idDoctor.eq();
		System.out.println(doctorCriteria.uniqueDoctor());
		
		System.out.println("Retrieving BabyMonitor by BabyMonitorCriteria");
		com.pancho.BabyMonitorCriteria babyMonitorCriteria = new com.pancho.BabyMonitorCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//babyMonitorCriteria.codSystem.eq();
		System.out.println(babyMonitorCriteria.uniqueBabyMonitor());
		
		System.out.println("Retrieving Solution by SolutionCriteria");
		com.pancho.SolutionCriteria solutionCriteria = new com.pancho.SolutionCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//solutionCriteria.idSolution.eq();
		System.out.println(solutionCriteria.uniqueSolution());
		
		System.out.println("Retrieving Diagnose by DiagnoseCriteria");
		com.pancho.DiagnoseCriteria diagnoseCriteria = new com.pancho.DiagnoseCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//diagnoseCriteria.idDiag.eq();
		System.out.println(diagnoseCriteria.uniqueDiagnose());
		
		System.out.println("Retrieving Response by ResponseCriteria");
		com.pancho.ResponseCriteria responseCriteria = new com.pancho.ResponseCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//responseCriteria.idResponse.eq();
		System.out.println(responseCriteria.uniqueResponse());
		
		System.out.println("Retrieving Question by QuestionCriteria");
		com.pancho.QuestionCriteria questionCriteria = new com.pancho.QuestionCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//questionCriteria.idQuest.eq();
		System.out.println(questionCriteria.uniqueQuestion());
		
		System.out.println("Retrieving QuestForm by QuestFormCriteria");
		com.pancho.QuestFormCriteria questFormCriteria = new com.pancho.QuestFormCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//questFormCriteria.idQuestForm.eq();
		System.out.println(questFormCriteria.uniqueQuestForm());
		
	}
	
	
	public static void main(String[] args) {
		try {
			RetrieveAndUpdateTaller1PDSData retrieveAndUpdateTaller1PDSData = new RetrieveAndUpdateTaller1PDSData();
			try {
				retrieveAndUpdateTaller1PDSData.retrieveAndUpdateTestData();
				//retrieveAndUpdateTaller1PDSData.retrieveByCriteria();
			}
			finally {
				com.pancho.Taller1PDSPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
